{include file="Public:header2"/}
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <form method="get" action="{:url('/admin/order_list')}" class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-input-block">
                        <input type="text" name="keyword" value="{$Request.get.keyword}" placeholder="请输入商品名称" autocomplete="off" class="layui-input">
                    </div>
                </div>
                
                <div class="layui-inline">
                    <div class="layui-input-inline" style="width: 180px;margin-left: 0px">
                        <select name="order_type" style="width:100%">
                            <option value="">--请选择盒子类型--</option>
                            <option value="2" {if condition="$Request.get.order_type eq 2"}selected{/if}>无限赏</option>
                            <option value="1" {if condition="$Request.get.order_type eq 1"}selected{/if}>一番赏</option>
                            <option value="3" {if condition="$Request.get.order_type eq 3"}selected{/if}>擂台赏</option>
                
                            <!--<option value="4" {if condition="$Request.get.order_type eq 4"}selected{/if}>抽卡机</option>-->
                            <option value="5" {if condition="$Request.get.order_type eq 5"}selected{/if}>积分赏</option>
                            <option value="6" {if condition="$Request.get.order_type eq 6"}selected{/if}>全局赏</option>
                            <option value="8" {if condition="$Request.get.order_type eq 8"}selected{/if}>领主赏</option>
                            <option value="9" {if condition="$Request.get.order_type eq 9"}selected{/if}>连击赏</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-inline" style="width: 180px;margin-left: 0px">
                        <select name="insurance_is" style="width:100%">
                            <option value="">--是否保险柜--</option>
                            <option value="2" {if condition="$Request.get.insurance_is eq 2"}selected{/if}>否</option>
                            <option value="1" {if condition="$Request.get.insurance_is eq 1"}selected{/if}>是</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-inline" style="width: 180px;margin-left: 0px">
                        <select name="goodslist_type" style="width:100%">
                            <option value="">--选择类型--</option>
                            <option value="2" {if condition="$Request.get.goodslist_type eq 2"}selected{/if}>预售</option>
                            <option value="1" {if condition="$Request.get.goodslist_type eq 1"}selected{/if}>现货</option>
                        </select>
                    </div>
                </div>
                <input type="hidden" name="id" value="{$user_id}">
                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </form>
        <div class="layui-card-body">
            <xblock>
                <div style="padding-bottom: 10px;">
                    <a class="layui-btn" onclick="user_goodslist_add({$user_id})" >添加奖品</a>

                    <span style="line-height:40px;float:left;">合计余额： {$total_money}</span>
                    <span style="line-height:40px;float:right;">共有数据： {$count}件</span>
                </div>
            </xblock>
            <table class="layui-table">
                <thead>
                <tr>
                    <th>商品名称</th>
                    <th>商品图片</th>
                    <th>商品数量</th>
                    <th>可退回（幸运币）数量</th>
                    <th>盒子类型</th>
                    <th>时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr>
                    <td>{$vo['goodslist_title']}</td>
                    <td><img src="{PHP} echo imageUrl($vo['goodslist_imgurl']){/php}" style="width:60px;height:60px;"></td>
                    <td>{$vo['prize_num']}</td>
                    <td>{$vo['goodslist_money']}</td>
                    <td>
                    {if condition="$vo['order_type'] eq 1"}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">一番赏</button>
                    {elseif condition="$vo['order_type'] eq 2" /}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">无限赏</button>
                    {elseif condition="$vo['order_type'] eq 3" /}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">擂台赏</button>
                    {elseif condition="$vo['order_type'] eq 5" /}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">积分赏</button>
                    {elseif condition="$vo['order_type'] eq 6" /}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">全局赏</button>
                    {elseif condition="$vo['order_type'] eq 8" /}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">领主赏</button>
                    {elseif condition="$vo['order_type'] eq 9" /}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">连击赏</button>
                    {elseif condition="$vo['order_type'] eq -5" /}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">兑换码获取</button>
                    {elseif condition="$vo['order_type'] eq -6" /}
                        <button class="layui-btn layui-btn-success layui-btn-radius layui-btn-sm">后台新增</button>
                    {/if}
                    </td>
                    <td>{$vo['addtime']|date="Y-m-d H:i"}</td>
                    <td>
                        <a style="text-decoration:none" title="增加奖品" href="javscript:;" onclick="give_add('增加奖品数量','{$vo['goodslist_title']}','{$vo['id']}', '1')" class="layui-btn layui-btn-default layui-btn-xs">增加奖品</a>
                        <a style="text-decoration:none" title="减少奖品" href="javscript:;" onclick="give_add('减少奖品数量','{$vo['goodslist_title']}','{$vo['id']}', '2')" class="layui-btn layui-btn-default layui-btn-xs">减少奖品</a>
                    </td>
                </tr>
                {/volist}

                {if condition="empty($list)"}
                <tr><td colspan='10' style="text-align:center;">暂时没有数据！</td></tr>
                {/if}

                </tbody>
            </table>
            <div class="my_page layui-box layui-laypage layui-laypage-default">
                {$page|raw}
            </div>
        </div>
    </div>
</div>
{include file="Public:footer"/}
<script type="text/javascript">
    layui.use(['table','laydate'], function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#start_time' //指定元素
            ,type : 'date'
            ,trigger : 'click'
        });
        laydate.render({
            elem: '#end_time' //指定元素
            ,type : 'date'
            ,trigger : 'click'
        });
    });
    
    
        
    //赠送优惠劵
    function give_add(title,goodslist_title,id, type){
        layer.open({
            type: 2,
            title: goodslist_title+title,
            shadeClose: true,
            shade: 0.8,
            area: ['600px', '400px'],
            content: "/admin/give_order_list/goodslist_id/"+id+"/type/"+type, //iframe的url
        });
    }
    
    
    //添加奖品
    function user_goodslist_add(user_id) {
        var url  = "{:url('/admin/user_goodslist_add/user_id/"+user_id+"')}";
        layer.open({
            type: 2,
            title: '添加奖品',
            shadeClose: false,
            shade: 0.3,
            area: ['90%', '90%'],
            content: url,
        });
    }

    //编辑奖品
    // function user_goodslist_edit(id) {
    //     var url  = "{:url('/admin/user_goodslist_edit?id="+id+"')}";
    //     layer.open({
    //         type: 2,
    //         title: '编辑兑换码奖品',
    //         shadeClose: false,
    //         shade: 0.3,
    //         area: ['90%', '90%'],
    //         content: url,
    //     });
    // }
</script>
</body>
</html>


